package com.vesystem.vegua.exceptionConfig;

import lombok.Getter;
import org.springframework.http.HttpStatus;

/**
 * @auther hcy
 * @create 2020-12-11 9:34
 * @Description
 * 401 -- 账号或密码错误，token无效、过期
 * 403 -- 权限不够，授权过期
 * 415 -- 方法参数不正确
 * 510 -- 数据不存在或已存在、操作不符合预定的流程等
 *
 *
 *
 *
 */
@Getter
public enum ErrorCode {

    LOGINNAME_ALERADY_EXIST(1001,HttpStatus.UNAUTHORIZED,"账号已经存在"),
    LOGINNAME_OR_PASSWORD_ERROR(1002,HttpStatus.UNAUTHORIZED,"账号或密码错误"),
    USER_STATUS_BLOCK_UP(1003, HttpStatus.UNAUTHORIZED, "账号被冻结"),
    VERIFY_JWT_FAILED(1004, HttpStatus.UNAUTHORIZED, "token不合法"),
    TOKEN_EXPIRED(1005, HttpStatus.UNAUTHORIZED, "token过期"),
    METHOD_ARGUMENT_NOT_VALID(1006, HttpStatus.UNSUPPORTED_MEDIA_TYPE, "方法参数验证失败,请参考API文档"),
    SYSTEM_EXPIRES(1007,HttpStatus.FORBIDDEN,"系统授权已过期，请联系管理员!"),
    DATA_ALERADY_EXIST(1008,HttpStatus.NOT_EXTENDED,"数据已经存在"),
    DATA_NOT_EXIST(1009,HttpStatus.NOT_EXTENDED,"数据不存在"),
    NOT_DELETE_APP_BECAUSE_MAPPING_USER(1010,HttpStatus.NOT_EXTENDED,"不能删除存在映射关系的应用"),
    NOT_DELETE_ICON_BECAUSE_MAPPING_APP(1011,HttpStatus.NOT_EXTENDED,"不能删除存在映射关系的图标"),
    OLD_PASSWORD_ERROR(1012,HttpStatus.NOT_EXTENDED,"旧密码错误"),
    UNKNOWN_ERROR(1013,HttpStatus.NOT_EXTENDED,"未知的系统错误，请提交给开发人员"),
    THE_NUMBER_OF_LICENSE_USERS_IS_TOO_SMALL(1014,HttpStatus.NOT_EXTENDED,"授权文件中的用户数量小于当前已经创建的用户数量，授权操作失败！"),
    USE_ROOT_TO_MODIFY_THE_CONFIGURATION(1015,HttpStatus.NOT_EXTENDED,"请使用root账户修改系统配置修改配置"),
    CONFIGURATION_ITEMS_THAT_ARE_NOT_INCLUDED(1016,HttpStatus.NOT_EXTENDED,"未被收录的配置项,更新配置项失败"),
    ;



    private final int code;
    private final HttpStatus status;
    private final String message;

    ErrorCode(int code, HttpStatus status, String message) {
        this.code = code;
        this.status = status;
        this.message = message;
    }
}
